<template>
	<view class="container">
		<!-- 导航栏 -->
		<view class="nav-bar">
			<view class="title">全部分类</view>
		</view>

		<!-- 搜索框 -->
		<view class="search-container">
			<view class="search-box">
				<u-icon name="search" color="#454455" size="28"></u-icon>
				<input class="search-input" placeholder="商品名称、品牌、规格型号" placeholder-class="placeholder" />
				<view class="search-btn">搜索</view>
			</view>
		</view>

		<!-- 分类列表 -->
		<view class="content-box">
			<!-- tab列表 -->
			<view class="tab-box">
				<view class="tab-info" :class="{active : tabIndex == index}" v-for="(item,index) in tabList"
					:key="index" @click="chooseTab(index,item)">
					{{item || '--'}}
				</view>
			</view>
			<!-- 列表内容 -->
			<view class="right_">
				<view class="filter-box">
					<view class="filter-info">
						<view style="margin-right: 5px;">宝富</view>
						<u-icon name="arrow-down" color="#7A7A7A" size="14"></u-icon>
					</view>
					<view class="filter-info">
						<view style="margin-right: 5px;">型号</view>
						<u-icon name="arrow-down" color="#7A7A7A" size="14"></u-icon>
					</view>
				</view>

				<view class="content-info" v-for="(item,index) in contentList" :key="index">
					<image class="sub-img" src="https://seep.sdstm.cn/oss/upload/image/20251009/1160997822313529344.png"
						mode="">
					</image>
					<view class="product-info">
						<view class="product-name">喷烤漆房 经济型 (埋地安装)</view>
						<view class="shop-desc">
							<view class="shop-rent">可租</view>
							<view class="shop-label">Blowtherm/宝富</view>
						</view>

						<view class="price-section">
							<view class="current-price">
								<text class="price-integer">¥132.00</text>
								<text class="price-decimal">¥298</text>
							</view>
							<u-number-box integer min="0" v-model="value">
								<view slot="minus" class="minus">
									<u-icon name="minus" size="12"></u-icon>
								</view>
								<text slot="input" style="width: 26px;text-align: center;"
									class="input">{{value}}</text>
								<view slot="plus" class="plus">
									<u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
								</view>
							</u-number-box>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 结算 -->
		<view class="car-box">
			<view class="car-image"  @click="goShopCar()">
				<image class="car-img" src="/static/image/shop.png" mode=""></image>
				<view class="shop-num">{{cartcount}}</view>
			</view>
			<view class="price_">￥{{cartprice}}</view>
			<view class="btn_">结算</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				msg: 2,
				tabList: ['喷涂车间', '烤漆房', '举升机', '洗车机', '冷媒机', '扒胎机', '平衡机'],
				tabIndex: 0,
				contentList: [{}, {}, {}, {}],
				value: 1,	
				cartcount:0,
				cartprice:0,
			}
		},
		methods: {
			// 选择tab
			chooseTab(index, data) {
				this.tabIndex = index
			},
		}
	}
</script>

<style scoped lang="scss">
	.container {
		background-image: url('https://seep.sdstm.cn/oss/upload/image/20251009/1160994082714025984.png');
		background-size: 100%;
		background-repeat: no-repeat;
		background-position: top;
		background-color: #ffffff;
		min-height: 100vh;
		padding-top: 45px;
		box-sizing: border-box;
	}

	/* 导航栏样式 */
	.nav-bar {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 8px 15px;
		box-sizing: border-box;
	}

	.title {
		font-size: 18px;
		color: #fff;
	}

	/* 搜索框样式 */
	.search-container {
		padding: 15px;
		box-sizing: border-box;
	}

	.search-box {
		position: relative;
		height: 40px;
		border-radius: 40px;
		background-color: #f5f5f5;
		display: flex;
		align-items: center;
		padding: 0 5px;
	}

	.search-input {
		flex: 1;
		height: 100%;
		font-size: 14px;
	}

	.placeholder {
		color: #999999;
		margin-left: 5px;
	}

	.search-btn {
		padding: 5px 14px;
		box-sizing: border-box;
		color: #fff;
		background: #2984F1;
		border-radius: 40px;
	}


	.content-box {
		width: 100%;
		display: flex;
		min-height: 80vh;
	}

	.tab-box {
		width: 26%;
		font-size: 14px;
		background: #F5F5F5;
		padding-top: 10px;
		box-sizing: border-box;
	}

	.tab-info {
		width: 100%;
		height: 50px;
		line-height: 50px;
		text-align: center;
		color: #636363;
	}

	.active {
		height: 40px;
		line-height: 40px;
		background: #fff;
		color: #216AC1;
		border-right: 4px solid #216AC1;
		width: 97%;
	}

	.right_ {
		width: 74%;
		background: #fff;
		padding: 10px;
		box-sizing: border-box;
	}

	.filter-box {
		display: flex;
		align-items: center;
		margin-bottom: 20px;
	}

	.filter-info {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 30px;
		background: #F6F6F6;
		border-radius: 5px;
		font-size: 12px;
		color: #000000;
		margin-right: 14px;
		padding: 0 14px;
		box-sizing: border-box;
	}

	.content-info {
		margin-bottom: 10px;
		display: flex;
		align-items: center;
	}

	.sub-img {
		width: 60px;
		height: 60px;
		border-radius: 8px;
		border: 1px solid #EBEBEB;
	}

	.product-info {
		flex: 1;
		margin-left: 5px;
	}


	.product-name {
		font-size: 14px;
		font-weight: bold;
		color: #000000;
		margin-bottom: 5px;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}


	.shop-desc {
		display: flex;
		align-items: center;
		margin: 8px 0;
	}

	.shop-rent {
		margin-right: 5px;
		background-color: #77B663;
		color: #fff;
		font-size: 12px;
		padding: 2px 5px;
		box-sizing: border-box;
		border-radius: 40px;
		font-weight: normal;
	}

	.shop-label {
		background-color: #F5F5F5;
		color: #5A5656;
		font-size: 12px;
		padding: 2px 5px;
		box-sizing: border-box;
		border-radius: 40px;
		font-weight: normal;
	}

	/* 价格区域样式 */
	.price-section {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 20px;
	}

	.current-price {
		display: flex;
		align-items: baseline;
		margin-right: 10px;
	}

	.price-integer {
		font-size: 14px;
		font-weight: bold;
		color: #F8485D;
	}

	.price-decimal {
		font-size: 10px;
		color: #B3AFAF;
		text-decoration: line-through;
		margin-left: 5px;
	}

	.minus {
		width: 22px;
		height: 22px;
		border-width: 1px;
		border-color: #E6E6E6;
		border-style: solid;
		border-top-left-radius: 5px;
		border-top-right-radius: 5px;
		border-bottom-left-radius: 5px;
		border-bottom-right-radius: 5px;
		@include flex;
		justify-content: center;
		align-items: center;
	}

	.input {
		padding: 0 10px;
	}

	.plus {
		width: 22px;
		height: 22px;
		background-color: #216AC1;
		border-radius: 5px;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
	.car-box {
		background: #FFFFFF;
		width: 90%;
		position: fixed;
		bottom: 16px;
		left: 50%;
		transform: translateX(-50%);
		border-radius: 50px;
		padding: 5px 5px 5px 14px;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
	}
	
	.car-image {
		width: 36px;
		height: 30px;
		position: relative;
	}
	
	.car-img {
		width: 100%;
		height: 100%;
	}
	
	.shop-num {
		width: 15px;
		height: 15px;
		font-size: 12px;
		background: #216AC1;
		border-radius: 50%;
		position: absolute;
		top: 0;
		right: 0;
		text-align: center;
		line-height: 15px;
		color: #FFFFFF;
	}
	
	.price_ {
		color: #216AC1;
		font-size: 18px;
		font-weight: bold;
		flex: 1;
		text-align: end;
		padding-right: 15px;
		box-sizing: border-box;
	}
	
	.btn_ {
		width: 80px;
		height: 36px;
		color: #fff;
		text-align: center;
		line-height: 36px;
		border-radius: 50px;
		background: #216AC1;
	}
</style>